﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace JohanWPFTest
{
    public class Klass : INotifyPropertyChanged
    {
        private String namn;
        private String newNamn;


        public String NewNamn
        {
            get
            {
                return newNamn;
            }
            set
            {
                newNamn = value;
            }
        }




        public string Namn
        {
            get
            {
                return namn;
            }
            set
            {
                if (namn != value)
                {
                    namn = value;
                    OnPropertyChanged("Namn");
                }
            }
        }


        public Klass()
        {
            namn = "Kolla här!";
        }

        public void ChangeName()
        {
            Namn = "Lol";
        }


        public void ChangeNameToString()
        {
            Namn = newNamn;
        }


        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;

            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }




    }
}
